package com.juc.executorService.executorService1;

import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class Run2 {

	public static void main(String[] args) throws InterruptedException, ExecutionException {
		List list =new ArrayList();
		list.add(new MyCallableA());
		list.add(new MyCallableB2());
		ExecutorService executor = Executors.newCachedThreadPool();
		//invokeAny只取得最先完成任务的结果值
		String getValueA = (String) executor.invokeAny(list);
		System.out.println("================= " + getValueA);
		System.out.println("ZZZZZZZZZZZZZZZZZZZZZZZZZZ");
	}
}
